﻿@using SCMS.Resource
@model SCMS.UI.Areas.Admin.Models.SystemUser.ChangePassword
@{AjaxOptions ajaxOpts = new AjaxOptions
  {
      UpdateTargetId = "AdminSystemUserDiv",
      LoadingElementId = "loading",
      HttpMethod = "Post",
      Url = Url.Action("ChangePassword"),
      OnBegin = "return ValidatedPasswords();",
      OnSuccess = "PasswordChangeResponse"
  };}

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

<div class="partialViewCard">
    <div class="partialViewCardHeader">
        <h3>
            @Resources.PasswordReset_ChangePassword_ChangePassword
        </h3>
    </div>
    @using (Ajax.BeginForm(null, null, ajaxOpts, new { @class = "form" }))
    {
    
        @Html.ValidationSummary(true)
        <br />
        <table width="40%" align="center" border="0" cellpadding="2" cellspacing="2">
            <tr>
                <td width="50%" align="right">@Resources.SystemUser_ChangePassword_OldPassword:</td>
                <td width="50%">
                    @Html.PasswordFor(m => m.OldPassword)
                    @Html.ValidationMessageFor(m => m.OldPassword)
                </td>
            </tr>
            <tr>
                <td width="50%" align="right">@Resources.PasswordReset_ChangePassword_NewPassword:</td>
                <td width="50%">
                    @Html.PasswordFor(m => m.NewPassword, new { id = "newpassword" })
                    @Html.ValidationMessageFor(m => m.NewPassword)
                </td>
            </tr>
            <tr>
                <td width="50%" align="right">@Resources.PasswordReset_ChangePassword_ConfirmPassword:</td>
                <td width="50%">
                    @Html.PasswordFor(m => m.ConfirmNewPassword, new { id = "confirmpassword"})
                    @Html.ValidationMessageFor(m => m.ConfirmNewPassword)
                </td>
            </tr>
            <tr>
                <td align="right">
                    @Ajax.ActionLink(Resources.SystemUser_ChangePassword_BackToMyProfile, "_ViewProfile", new { id = "" }, new AjaxOptions
                    {
                        UpdateTargetId = "AdminSystemUserDiv",
                        LoadingElementId = "loading",
                        Url = Url.Action("_ViewProfile")
                    })
                </td>
                <td>
                    <input type="submit" value="@Resources.PasswordReset_ChangePassword_ChangePassword" class="btn green" />
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center" style="color: Red;" id="statusmsg">
                    @ViewBag.StatusMsg                    
                </td>
            </tr>
        </table>
    }
    <br />
</div>